package aybolit.core.objects.model;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * Created by IntelliJ IDEA.
 * User: Vadim
 * Date: 13.03.13
 * Time: 16:57
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "beds")
public class Beds implements Serializable {
    private int bedId;

    @javax.persistence.Column(name = "bed_id")
    @Id
    public int getBedId() {
        return bedId;
    }

    public void setBedId(int bedId) {
        this.bedId = bedId;
    }

    private int chamberId;

    @javax.persistence.Column(name = "chamber_id")
    @Basic
    public int getChamberId() {
        return chamberId;
    }

    public void setChamberId(int chamberId) {
        this.chamberId = chamberId;
    }

    private int bedTypeId;

    @javax.persistence.Column(name = "bed_type_id")
    @Basic
    public int getBedTypeId() {
        return bedTypeId;
    }

    public void setBedTypeId(int bedTypeId) {
        this.bedTypeId = bedTypeId;
    }

    private int bedStatusId;

    @javax.persistence.Column(name = "bed_status_id")
    @Basic
    public int getBedStatusId() {
        return bedStatusId;
    }

    public void setBedStatusId(int bedStatusId) {
        this.bedStatusId = bedStatusId;
    }

    private Timestamp timestamp;

    @javax.persistence.Column(name = "timestamp_")
    @Basic
    public Timestamp getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(Timestamp timestamp) {
        this.timestamp = timestamp;
    }

    private Integer patientId;

    @javax.persistence.Column(name = "patient_id")
    @Basic
    public Integer getPatientId() {
        return patientId;
    }

    public void setPatientId(Integer patientId) {
        this.patientId = patientId;
    }
    private String bname;

    @javax.persistence.Column(name = "name")
    @Basic
    public String getBname() {
        return bname;
    }

    public void setBname(String bname) {
        this.bname = bname;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Beds beds = (Beds) o;

        if (bedId != beds.bedId) return false;
        if (bedStatusId != beds.bedStatusId) return false;
        if (bedTypeId != beds.bedTypeId) return false;
        if (chamberId != beds.chamberId) return false;
        if (patientId != beds.patientId) return false;
        if (timestamp != null ? !timestamp.equals(beds.timestamp) : beds.timestamp != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = bedId;
        result = 31 * result + chamberId;
        result = 31 * result + bedTypeId;
        result = 31 * result + bedStatusId;
        result = 31 * result + (timestamp != null ? timestamp.hashCode() : 0);
        return result;
    }

    private Patientes patientesByPatientId;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "patient_id", referencedColumnName = "patient_id", table = "beds", nullable = false)
    Patientes getPatientesByPatientId() {
        return patientesByPatientId;
    }

    public void setPatientesByPatientId(Patientes patientesByPatientId) {
        this.patientesByPatientId = patientesByPatientId;
    }

    private Chambers chambersByChamberId;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "chamber_id", referencedColumnName = "chamber_id", nullable = false, table = "beds")
    Chambers getChambersByChamberId() {
        return chambersByChamberId;
    }

    public void setChambersByChamberId(Chambers chambersByChamberId) {
        this.chambersByChamberId = chambersByChamberId;
    }

    private Status statusByBedStatusId;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "bed_status_id", referencedColumnName = "status_id", nullable = false, table = "beds")
    Status getStatusByBedStatusId() {
        return statusByBedStatusId;
    }

    public void setStatusByBedStatusId(Status statusByBedStatusId) {
        this.statusByBedStatusId = statusByBedStatusId;
    }

    private Types typesByBedTypeId;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "bed_type_id", referencedColumnName = "type_id", nullable = false, table = "beds")
    Types getTypesByBedTypeId() {
        return typesByBedTypeId;
    }

    public void setTypesByBedTypeId(Types typesByBedTypeId) {
        this.typesByBedTypeId = typesByBedTypeId;
    }
}
